package org.parademo.dao;

import org.hibernate.SessionFactory;
import org.hibernate.classic.Session;
import org.parademo.model.Entity;

public abstract class GenericDao<T extends Entity> {

    private final SessionFactory sessionFactory;

    public GenericDao(SessionFactory sessionFactory) {
        this.sessionFactory = sessionFactory;
    }

    public SessionFactory getSessionFactory() {
        return sessionFactory;
    }

    public Session getCurrentSession() {
        return getSessionFactory().getCurrentSession();
    }
}
